package com.coder520.mamabike.controller;

import com.coder520.mamabike.common.ServerResponse;
import com.coder520.mamabike.service.IBikeService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

/**
 * Created by ASUS on 2017/8/21.
 */
@RestController
@RequestMapping("/bike")
public class BikeController {


    @Autowired
    private IBikeService iBikeService;

    @RequestMapping(value = "/findRoundBike/{coordinate}/{count}/{distance}")
    public ServerResponse findRoundBike(@PathVariable(value = "coordinate",required = true) String coordinate,@PathVariable(value = "count",required = false) Integer count,@PathVariable(value = "distance",required = false) Integer distance ){
        if(StringUtils.isNotBlank(coordinate)){
            return iBikeService.findRoundBikeGetDistance(coordinate,count,distance);
        }
        return ServerResponse.createByError("参数错误");
    }
}
